package pl.edu.agh.transstat.statictisc;

import java.util.List;

public class Median extends Function {

	public Median(){
		name = "Median";
	}
	
	@Override
	public double getValue(List<Double> values) {
		int size = values.size();
		if(size%2 == 1)
			return values.get(size/2);
		else
			return (values.get(size/2-1) + values.get(size/2))/2;
	}

}
